package com.qt.stream;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.function.IntFunction;

//toArray()
public class StreamDamo03 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();

        Collections.addAll(list,"张三丰","张无忌","张翠山","张强","张全蛋");

        String[] strings = list.stream().toArray(new IntFunction<String[]>() {
            @Override
            public String[] apply(int value) {
                return new String[value];
            }
        });

        String[] strings2 = list.stream().toArray(value ->  new String[value] );

        System.out.println(Arrays.toString(strings));


    }
}
